package com.liang.cloud.Handler;


import com.liang.cloud.Exception.SellException;
import com.liang.cloud.Util.ResultVoUtil;
import com.liang.cloud.Vo.ResultVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: 余亮亮
 * @description:
 * @create: 2020-02-16 13:48:09
 **/
@ControllerAdvice
public class SellerHandler {


    /**
     * 捕获到SellException异常，放回他的错误代码和异常信息
     * @param e
     * @return
     */
    @ExceptionHandler(value = SellException.class)
    @ResponseBody
    public ResultVo handerSellException(SellException e){
        return ResultVoUtil.error(e.getCode(),e.getMessage());
    }
}
